@include('admin._include.header')
<style>
    body{
        background: #fff;
    }
</style>
<body>

<div class="layui-fluid">

    <div class="layui-tab layui-tab-brief" lay-filter="demo">
        <ul class="layui-tab-title">
            <li class="layui-this">分销商</li>
            <li>合伙人</li>
        </ul>
    </div>

    <div class="layui-tab-content">

        <div class="layui-tab-item layui-show">

            <div class="larry-container ">
                <div class="layui-row layui-col-space15 larryms-data-top">
                    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12 layui-col-lg12">
                        <table lay-filter="ad_table" class="layui-table"
                               lay-data="{height:'full-155',cellMinWidth:95,url:'{{url('user/user-list')}}',
                                page:true, id:'ad_table',toolbar:'#tools',defaultToolbar:[]}">
                            <thead>
                            <tr>
                                <th lay-data="{field:'nick_name',align:'center'}">昵称</th>
                                <th lay-data="{field:'balance',align:'center'}">分销收益</th>
                                <th lay-data="{title:'操作',templet:'#listBar',align:'center'}">操作</th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                </div>

            </div>
        </div>

        <div class="layui-tab-item">
            <h1>111111</h1>
        </div>
    </div>

</div>


<script type="text/html" id="listBar">
    <a class="layui-btn layui-btn-xs"  data-url="{{url('')}}?id=@{{ d.id }}" lay-event="edit">地址管理</a>
    <a class="layui-btn-warm layui-btn-xs"  data-url="{{url('')}}?id=@{{ d.id }}" lay-event="balance">余额流水</a>
</script>

<script>
    layui.config({
        base: "/plugin/layuiadmin/"  //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'table', 'console', 'element'], function(){
        var $ = layui.$,
            table = layui.table,
        element = layui.element;

        element.on('tab(demo)', function(data){
            $(this).parents('.layui-tab').next().find(".layui-tab-item:eq("+data.index+")").addClass('layui-show').siblings().removeClass('layui-show')
        });
        table.on('tool(ad_table)', function(obj){
            var data = obj.data;
            var that = this;
            var url = $(this).data('url');

            switch (obj.event) {
                case "show":
                    var arr = [];
                    var obj = {
                        'alt':data.avatar,
                        'pic':data.id+"_id",
                        'src':data.avatar,
                        'thumb':data.avatar
                    };
                    arr.push(obj);
                    var json = {
                        'title':data.avatar,
                        'id':data.id,
                        'start':0,
                        'data':arr
                    };
                    layer.photos({
                        photos: json
                        ,anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
                    });
                    break;

                case 'edit':
                    var index = layer.open({
                        title: data.title,
                        type: 2,
                        area: ['760px', '550px'],
                        content: url,
                        end: function() {
                            $(that).removeAttr("data-flag");
                            layui.cache.layerIndex = null;
                            table.reload('ad_table')
                        }
                    });
                    layer.full(index);
                    break;

                default:
                    break;

            }

        });

    });

</script>
</body>

@include('admin._include.footer')


